module("luci.controller.login.system", package.seeall)

local uci = require "luci.model.uci".cursor()

function index()
    local page   = node("login","system")
    page.target  = firstchild()
    page.title   = ("")
    page.order   = 100
    page.sysauth = "root"
    page.sysauth_authenticator = "jsonauth"
    page.index = true

    entry({"login", "system", "login"}, call("login_act"), nil)
end

function login_act()
    local code=0
	local msg="success"
	local result={}

	result["url"] = luci.dispatcher.build_url("web", "system", "index")
	result["token"] = luci.dispatcher.context.urltoken.stok

	data ={ 
		code=code,
		msg=msg,
		result=result
	}
	luci.http.prepare_content("application/json")
	luci.http.write_json(data)
end
